package com.yidushishizijie.staservice.schedule;

import com.yidushishizijie.staservice.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yidushishizijie.staservice.utils.DateUtil;

import java.util.Date;


@Component
public class ScheduledTask {

    @Autowired
    private StatisticsDailyService statisticsDailyService;

    @Scheduled(cron = "4 * * * * ? ")
    public void task1(){
        System.out.println("**************task1执行了");
    }

    @Scheduled(cron = "0 0 1 * * ?")
    public void task(){
        statisticsDailyService.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(),-1)));
    }


}
